//package com.zmn.plat.admin.api.channel;
//
//import com.alibaba.dubbo.config.annotation.Reference;
//import com.zmn.common.constant.GlobalConsts;
//import com.zmn.common.dto2.ResponseDTO;
//import com.zmn.common.utils.number.NumberUtil;
//import com.zmn.common.utils.string.StringUtil;
//import com.zmn.plat.admin.controller.PlatBaseController;
//import com.zmn.plat.dubbo.interfaces.channel.ChannelListRemoteService;
//import com.zmn.plat.dubbo.utils.DubboConsts;
//import org.springframework.stereotype.Controller;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestParam;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import javax.servlet.http.HttpServletRequest;
//import javax.servlet.http.HttpServletResponse;
//import java.util.List;
//
///**
// * 渠道查询API
// *
// * @uthor heguanghua
// * @since 2019/10/16 16:35
// */
//@Controller
//@RequestMapping("/api/channel/")
//public class ApiChannelListController extends PlatBaseController {
//
//    @Reference(version = DubboConsts.INTERFACE_VERSION, check = false)
//    private ChannelListRemoteService channelRemoteService;
//
//    /**
//     * 取得下级渠道列表
//     */
//    @RequestMapping(value = "listChilds")
//    @ResponseBody
//    public ResponseDTO<List> listChilds(HttpServletRequest request, HttpServletResponse response,
//                                        @RequestParam(value = "plat", required = false) Integer plat,
//                                        @RequestParam(value = "type", required = false) Integer type,
//                                        @RequestParam(value = "parentId", required = false) Integer parentId) {
//
//        return this.listChannelVtByQuery(plat, type, null, null, parentId, null, null);
//    }
//
//    /**
//     * 取得1级渠道列表
//     */
//    @RequestMapping(value = "listFirst")
//    @ResponseBody
//    public ResponseDTO<List> listFirst(HttpServletRequest request, HttpServletResponse response,
//                                       @RequestParam(value = "plat", required = false) Integer plat,
//                                       @RequestParam(value = "type", required = false) Integer type,
//                                       @RequestParam(value = "centId", required = false) Integer centId,
//                                       @RequestParam(value = "deptId", required = false) Integer deptId) {
//
//        return this.listChannelVtByQuery(plat, type, centId, deptId, GlobalConsts.TOP_ID, null, null);
//    }
//
//    /**
//     * 查询2级渠道
//     */
//    @RequestMapping(value = "search")
//    @ResponseBody
//    public ResponseDTO<List> search(HttpServletRequest request, HttpServletResponse response,
//                                    @RequestParam(value = "plat", required = false) Integer plat,
//                                    @RequestParam(value = "type", required = false) Integer type,
//                                    @RequestParam(value = "centId", required = false) Integer centId,
//                                    @RequestParam(value = "deptId", required = false) Integer deptId,
//                                    @RequestParam(value = "parentId", required = false) Integer parentId,
//                                    @RequestParam(value = "status", required = false) Integer status,
//                                    @RequestParam(value = "keyword", defaultValue = "") String keyword) {
//
//        if (StringUtil.isBlank(keyword)) {
//            return ResponseDTO.fail("请输入查询关键词");
//        }
//
//        return this.listChannelVtByQuery(plat, type, centId, deptId, parentId, status, keyword);
//    }
//
//    // region 搜索渠道
//
//    /**
//     * 搜索渠道
//     *
//     * @param plat     平台标识，1言而有信，2啄木鸟，3一步维修，4川南环保，Null不限
//     * @param type     渠道类型，1政企渠道，2商家渠道，3厂家渠道，4自有渠道，5推广渠道，6服务商渠道，Null不限
//     * @param centId   所属中心，Null不限
//     * @param deptId   所属部门，Null不限
//     * @param parentId 上级渠道Id，1表示1级渠道的parentId，Null不限
//     * @param status   状态，1禁用，2启用，Null不限
//     * @param keyword  渠道名称，支持中文及拼音模糊搜索，Null不限
//     * @return 渠道Id、渠道名称和状态字段列表
//     */
//    private ResponseDTO<List> listChannelVtByQuery(Integer plat, Integer type, Integer centId, Integer deptId, Integer parentId, Integer status) {
//        return this.listChannelVtByQuery(plat, type, centId, deptId, parentId, status, null);
//    }
//
//    private ResponseDTO<List> listChannelVtByQuery(Integer plat, Integer type, Integer centId, Integer deptId, Integer parentId, Integer status, String keyword) {
//
//        plat = NumberUtil.isNullOrZero(plat) ? null : plat;
//        type = NumberUtil.isNullOrZero(type) ? null : type;
//        centId = NumberUtil.isNullOrZero(centId) ? null : centId;
//        deptId = NumberUtil.isNullOrZero(deptId) ? null : deptId;
//        parentId = NumberUtil.isNullOrZero(parentId) ? null : parentId;
//        status = NumberUtil.isNullOrZero(status) ? null : status;
//        keyword = StringUtil.isBlank(keyword) ? null : keyword;
//
//        return channelRemoteService.listChannelVtByQuery(plat, type, centId, deptId, parentId, status, keyword);
//    }
//    // endregion
//
//}
